package com.tarena.lbs.business.config;

import com.tarena.lbs.base.protocol.exception.BusinessException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tarena.lbs.base.protocol.model.Result;
@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BusinessException.class)
    @ResponseBody
    public Result handleBusinessException(BusinessException e) {
        // 假设 Result 类有 code、message 和 data 字段
        return new Result(e.getCode(), e.getMessage(), null);
    }
}